/*
 * @lc app=leetcode.cn id=119 lang=javascript
 *
 * [119] 杨辉三角 II
 */

// @lc code=start
/**
 * @param {number} rowIndex
 * @return {number[]}
 */
var getRow = function(rowIndex) {
  let pre = [];
  let row = [];
  for (let i = 0; i <= rowIndex; i++) {
    row = new Array(i + 1).fill(1);
    for (let j = 1; j < row.length - 1; j++) {
      row[j] = pre[j - 1] + pre[j];
    }
    pre = row;
  }

  return pre;
};
// @lc code=end

